import time


def countdown(seconds):
    for i in range(seconds, 0, -1):
        print(f"\r倒计时 {i} 秒", end='', flush=True)
        time.sleep(1)
    print("\r倒计时结束！")


# 设置倒计时时长
seconds = 10

# 调用倒计时函数
countdown(seconds)
